<?php


class KanwilDao{
	
	public function getKanwil($kdkanwil){
		$db=Database::getInstance();
        $con=$db->getConnection(1);

        $query="SELECT kdkanwil,nmkanwil FROM t_kanwil WHERE kdkanwil='$kdkanwil'";

        $result=$con->prepare($query);
        $result->execute();

        if($result->rowCount()==1){
            return $result->fetch();
        }

        return false;
	}

    public function getNmKanwil($kdkanwil){
        $db=Database::getInstance();
        $con=$db->getConnection(1);

        $query="SELECT kdkanwil,nmkanwil FROM t_kanwil WHERE kdkanwil='$kdkanwil'";

        $result=$con->prepare($query);
        $result->execute();

        if($result->rowCount()==1){
            $hasil= $result->fetch();
            return $hasil['nmkanwil'];
        }

        return false;
    }

    public function getAllKanwil(){
        $db=Database::getInstance();
        $con=$db->getConnection(1);

        $query="SELECT kdkanwil,nmkanwil FROM t_kanwil WHERE kdkanwil<>'' ";

        $result=$con->prepare($query);
        $result->execute();

        if($result->rowCount()>=1){
            return $result->fetchAll();
        }

        return false;
    }


}

class Kanwil{
	
	var $kdkanwil;
	var $nmkanwil;
}


?>